//
//  MVTableViewCell.m
//  23-QQ音乐
//
//  Created by dllo on 16/8/15.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "MVTableViewCell.h"
#import "MVCollectionViewCell.h"
#import "MVCollectionList.h"

@interface MVTableViewCell () <UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>

@property (weak, nonatomic) IBOutlet UICollectionView *collectionView;


@end

@implementation MVTableViewCell

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    
    return _mvListArray.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    MVCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"collectionViewCell" forIndexPath:indexPath];
    cell.mvList = _mvListArray[indexPath.row];
    return cell;
}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    if (indexPath.row == 0) {
        NSLog(@"%@", NSStringFromCGRect(self.bounds));
        return CGSizeMake(CGRectGetWidth(collectionView.bounds), CGRectGetHeight(collectionView.bounds) / 2 - 15);
        
    }
    
    return CGSizeMake((CGRectGetWidth(collectionView.bounds) - 5) / 2, (CGRectGetHeight(collectionView.bounds)) / 4);
    
}

- (void)setMvListArray:(NSArray<MVCollectionList *> *)mvListArray {
    
    _mvListArray = mvListArray;
    [self.collectionView reloadData];
}

@end


